<template>
    <div class="cbox">
        <h5>子组件</h5>
        <div>来自父组件的msg：{{ msg }}</div>
        <input type="button" value="printMsg" @click="printMsg()">
        <div>info:{{ info }}</div>
        <input type="button" value="sendInfo" @click="sendInfo()">
    </div>
</template>

<script setup>
import { defineProps,defineEmits,defineExpose,ref } from "vue";

// let props = defineProps(["msg"])
let props = defineProps({
    msg:{
        type:String,
        default:""
    }
})

let printMsg = function(){
    // console.log( msg );
    console.log( props )
    console.log( props.msg )
}

let emit = defineEmits(["update:info"])
let info = ref("子组件数据");
let sendInfo = function(){
    emit("update:info",info.value);
}

let printTest = function(){
    console.log("子组件的printTest方法")
}
defineExpose({
    printTest
})
</script>

<style lang="sass" scoped>

</style>